package Lee_code;

public class Lee_53 {

    public int maxSubArray(int[] nums) {
        int pre = 0;
        int max = nums[0];

        for(int i: nums)
        {
            pre = Math.max(pre + i, i);
            max = Math.max(max, pre);
        }
        return max;
    }
}
